package com.junjie.utils;

import java.io.Serializable;

/**
 * 如果前后端分离，这个是提供给前端信息和数据的类
 * @param <T>
 */

public class CommonResult<T> implements Serializable {

    private Integer code;
    private String message;
    private T data;

    public CommonResult(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
    /**
     * 查询为空的时候使用的构造器
     * @param code
     * @param message
     */
    public CommonResult(Integer code, String message){
        this.code = code;
        this.message = message;
    }

    public CommonResult() {

    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "CommonResult{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
